package com.youlu.campus.admin.auth.shiro.permission;

import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.permission.PermissionResolver;
import org.apache.shiro.authz.permission.WildcardPermission;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by zhuhuaiqi
 *
 * @author zhuhuaiqi
 */
public class UriPermissionResolver implements PermissionResolver {

    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public Permission resolvePermission(String permissionString) {
        //logger.debug("UriPermissionResolver permissionString:{}", permissionString);
        if(permissionString.startsWith("/")) {
            return new UriPermission(permissionString);
        }
        return new WildcardPermission(permissionString);
    }
}
